<%--
  author: fuxueHu
  description: 简历信息管理页面
--%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" import="java.util.*"
         isELIgnored="false" %>
<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<rapid:override name="title">简历信息</rapid:override>
<rapid:override name="head_extend">
    <link href="/static/admin_v1/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/static/admin_v1/css/addTable.css" rel="stylesheet"/>
    <!-- 分页查看 -->
    <link rel="stylesheet" type="text/css" href="/static/dataTable/jquery.dataTables.min.css">
    <script type="text/javascript" src="/static/dataTable/jquery.dataTables.min.js"></script>
</rapid:override>

<rapid:override name="content">
    <div class="row" style="height: 100%">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>简历管理</h5>
                <div class="ibox-tools">
                    <button id="addButton" type="button" class="btn btn-w-m btn-success">添加简历</button>
                </div>
            </div>
            <div id="modal" class="modal">
                <div class="modal-content">
                    <span class="close">&times;</span>
                    <h2 id="h0">简历信息</h2>
                    <div class="ibox-content">

                        <form class="form-horizontal" id="dataForm" action="/admin/cv/add" enctype="multipart/form-data"
                              method="post" onsubmit="addCv()">
                            <div class="form-group">
                                <div class="col-sm-8">
                                    <div class="btn-group">
                                        <label title="上传图片" for="inputFile" class="btn btn-primary">
                                            <input type="file" name="file" id="inputFile" class="hide">
                                            导入简历
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">用户id：</label>
                                <div class="col-sm-8">
                                    <select class="form-control" id="user" name="userId">

                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-8">
                                    <button class="btn btn-sm btn-info" type="submit">导 入</button>
                                </div>
                            </div>
                            <button type="button" class="close">取消</button>
                        </form>
                    </div>
                </div>
            </div>
            <div class="ibox-content">
                <div class="table-responsive">
                    <table class="table table-striped" id="example">
                        <thead>
                        <tr>
                            <th><input type="checkbox">编号</th>
                            <th>简历名称</th>
                            <th>候选人姓名</th>
                            <th>联系方式</th>
                            <th>岗位名称</th>
                            <th>学历</th>
                            <th>最近公司</th>
                            <th>求职者状态</th>
                            <th>创建时间</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${cvInfoList}" var="cvShowInfo">
                            <tr>
                                <td>
                                    <input type="checkbox" value="${cvShowInfo.cvId}">
                                </td>
                                <td>${cvShowInfo.name}</td>
                                <td>${cvShowInfo.candidateName}</td>
                                <td>${cvShowInfo.email}</td>
                                <td>${cvShowInfo.positionName}</td>
                                <td>
                                    <c:choose>
                                        <c:when test="${cvShowInfo.eduBack==1}">
                                            高中
                                        </c:when>
                                        <c:when test="${cvShowInfo.eduBack==2}">
                                            大专
                                        </c:when>
                                        <c:when test="${cvShowInfo.eduBack==3}">
                                            本科
                                        </c:when>
                                        <c:otherwise>
                                            硕士
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                                <td>${cvShowInfo.workNumber}</td>
                                <td>${cvShowInfo.applicationStatus}</td>
                                <td>${cvShowInfo.createTime}</td>
                                <td>${cvShowInfo.updateTime}</td>
                                <td><a href="/admin/cv/find/${cvShowInfo.cvId}?eduBack=${cvShowInfo.eduBack}"><span
                                        class="glyphicon glyphicon-sunglasses"
                                        aria-hidden="true"></span></a>
                                    <a>
                                        <a class="glyphicon glyphicon-folder-close" href="/admin/cv/delete?cv_id=${cvShowInfo.cvId}"
                                    </a>

                                </td>
                            </tr>
                        </c:forEach>


                        </tbody>
                    </table>
                </div>

                <div id="deleteShow">

                </div>


            </div>
        </div>
    </div>

</rapid:override>

<rapid:override name="js_extend">
    <!-- Bootstrap table -->
    <script src="/static/admin_v1/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/static/admin_v1/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="/static/admin_v1/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/static/admin_v1/js/bootstrap-paginator.js"></script>

    <%--    日期--%>
    <script src="/static/admin_v1/js/plugins/layer/laydate/laydate.js"></script>

    <!-- Peity -->
    <script src="/static/admin_v1/js/bootstrap-table-demo.js"></script>
    <script src="/static/admin_v1/js/date.js"></script>
    <script src="/static/admin_v1/js/addTable.js"></script>
    <%--    分页查看-2--%>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#example").dataTable({
                "bProcessing": true, //DataTables载入数据时，是否显示‘进度’提示
                "aLengthMenu": [5, 10, 15], //更改显示记录数选项
                "sPaginationType": "full_numbers", //详细分页组，可以支持直接跳转到某页
                "bAutoWidth": true, //是否自适应宽度
                //"bJQueryUI" : true,
                "oLanguage": { //国际化配置
                    "sProcessing": "正在获取数据，请稍后...",
                    "sLengthMenu": "显示 _MENU_ 条",
                    "sZeroRecords": "没有您要搜索的内容",
                    "sInfo": "从 _START_ 到  _END_ 条记录 总记录数为 _TOTAL_ 条",
                    "sInfoEmpty": "记录数为0",
                    "sInfoFiltered": "(全部记录数 _MAX_ 条)",
                    "sInfoPostFix": "",
                    "sSearch": "搜索",
                    "sUrl": "",
                    "oPaginate": {
                        "sFirst": "第一页",
                        "sPrevious": "上一页",
                        "sNext": "下一页",
                        "sLast": "最后一页"
                    }
                },
            });
        });
    </script>
    <script>
        function deleteCv(id)
        {

            $.ajax(
                {
                    url: "/admin/cv/delete",
                    method: "POST",
                    dataType: "json",
                    data:{'cv_id':id},
                    contentType: "application/json",
                    success: res => {
                        if (res.row > 0) {
                            $("#deleteShow").append('<div  class="alert alert-success alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>删除成功</div>')
                        }
                    }

                }
            );
        }

    </script>
    <script>
        $.ajax({
            url:'/admin/user/find/candidate',
            method:"get",
            dataType: "json",
            success:res=>{
                for(var i in res){
                    map=res[i]
                    $('#user').append(
                        '<option value="'+map.userId+'">'+map.userName+'</option>'
                    )
                }
            }
        })
    </script>


</rapid:override>

<%@include file="/jsp/common/admin/base.jsp" %>